home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / mail110 / save.c < prev    next >
C/C++ Source or Header  |  1994-02-08  |  1KB  |  60 lines

  1. //=========================================================
  2. //
  3. //    save.c
  4. //
  5. //    void saveto(char *xfile, int header)
  6. //
  7. //    Save the current message in the file, with or without headers.
  8. //
  9. //=========================================================
  10.  
  11. // $Id: save.c,v 1.2 1994/02/08 23:33:54 gbj Exp user $
  12.  
  13. /*
  14. $Log: save.c,v $
  15.  * Revision 1.2  1994/02/08  23:33:54  gbj
  16.  * First public release.
  17.  *
  18.  * Revision 1.1  1994/02/08  03:16:14  gbj
  19.  * Initial revision
  20.  *
  21. */
  22.  
  23. #include "mailer.h"
  24. #include "utils.h"
  25.  
  26. static char buf[4096], *bp;
  27.  
  28. void saveto(char *xfile, int header)
  29. {
  30.     int res;
  31.     char tfile[128];
  32.     
  33.     if (xfile == NULL)
  34.         strcpy(tfile, "mbox.txt");
  35.     else if (*xfile == '\0')
  36.         strcpy(tfile, "mbox.txt");
  37.     else
  38.         strcpy(tfile, xfile);
  39.     
  40.     res=tmp_msg(cmsg, "post.$$$", FALSE, TRUE);
  41.     if (res)
  42.     {
  43.         fprintf(stderr, "saveto: Unable to extract message %d\n", cmsg);
  44.         return;
  45.     }
  46.  
  47.     if (header)
  48.         res=fcopy("post.$$$", tfile, TRUE);
  49.     else
  50.         res=fcopy("post.$$$", tfile, FALSE);
  51.     if (res)
  52.     {
  53.         if (res != -1)
  54.             fprintf(stderr, "saveto: Couldn't copy %s to %s\n",
  55.                 "post.$$$", tfile);
  56.     }
  57.     remove("post.$$$");
  58.     return;
  59. }
  60.